<template>
    <div>
        <ul>
            <li v-for="(item, ind) in list" :key="item.id">{{ item }}<button @click="delBtn(ind)">删除</button></li>
        </ul>
        <button @click="addBtn">生成</button>
    </div>
</template>

<script>
export default {
    components: {},
    props: {},
    data() {
        return {
            list: [],
        }
    },
    computed: {},
    watch: {},
    created() {},
    methods: {
        addBtn() {
            this.list.push(Math.floor(Math.random() * 10))
        },
        delBtn(i) {
            this.list.splice(i, 1)
        },
    },
}
</script>

<style scoped></style>
